#include "graphsupport/graph/generate/DefaultGraphGenerator.h"

#include <iostream>

#include "graphsupport/graph/BiGraph.h"

DefaultGraphGenerator::DefaultGraphGenerator(
	const IGraphOperationPtr & operationPtr
)
	: operationPtr( operationPtr )
{
}

void DefaultGraphGenerator::generateGraph( Graph & graph, IOperationSettings & genSettings )
{
	BiGraph * bigraph = dynamic_cast< BiGraph * >( & graph );
	if ( bigraph && genSettings.firstBipart > -1 && genSettings.secondBipart > -1 )
	{
		bigraph->initBi( genSettings.firstBipart, genSettings.secondBipart );
	} else
	{
		graph.init( genSettings.vertexCount );
	}
	operationPtr->applyTo( graph, genSettings );
}

IGraphOperationPtr & DefaultGraphGenerator::getOperation()
{
	return operationPtr;
}


